package com.wdc.贪心;

import java.util.Arrays;

public class E01Leetcode455 {
    public int findContentChildren(int[] g, int[] s) {
        int result = 0;
        int index = s.length - 1;
        Arrays.sort(g);
        Arrays.sort(s);
        for (int i = g.length - 1; i >= 0; i--) {
            if (  index >= 0 && s[index] >= g[i] ){
                result++;
                index--;
            }

        }
        return result;
    }

    public static void main(String[] args) {
        int[] g = {1,2};
        int[] s = {1,2,3};
        E01Leetcode455 e01Leetcode455 = new E01Leetcode455();
        System.out.println(e01Leetcode455.findContentChildren(g, s));
    }
}
